#include "led_dev.h"


#define sysRunLED_GPIO		GPIO_NUM_18


TaskHandle_t xMSGRecvTask = NULL;

void LED_Toggle_Handle(void *pvParameters)
{
    uint8_t LED_Toggle_flag = 0;
    while(1)
    {
        LED_Toggle_flag = !LED_Toggle_flag;
        if(LED_Toggle_flag) gpio_set_level(sysRunLED_GPIO, 1);
        else gpio_set_level(sysRunLED_GPIO, 0);
        // printf("LED toggled\n");
        vTaskDelay(500 / portTICK_PERIOD_MS);
    }
}
/**
  * @brief  LED初始化
  * @param  None
  * @retval None
  * @note   None
*/
void LED_Init(void)
{
	gpio_config_t gpio_config_structure;

	gpio_config_structure.pin_bit_mask = (1ULL << sysRunLED_GPIO);
	gpio_config_structure.mode = GPIO_MODE_OUTPUT;
	gpio_config_structure.pull_up_en = 0;
	gpio_config_structure.pull_down_en = 0;
	gpio_config_structure.intr_type = GPIO_PIN_INTR_DISABLE;

	gpio_config(&gpio_config_structure);
	gpio_set_level(sysRunLED_GPIO, 1);

  xTaskCreatePinnedToCore(LED_Toggle_Handle,"LED_Toggle_Handle",1024,NULL,20,&xMSGRecvTask,1);
}

